package com.zzy.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzy.system.domain.PurchaseOrderDetail;
import com.zzy.system.domain.PurchaseOrderDetailItem;
import com.zzy.system.mapper.PurchaseOrderDetailItemMapper;
import com.zzy.system.mapper.PurchaseOrderDetailMapper;
import com.zzy.system.service.IPurchaseOrderDetailService;
import com.zzy.system.service.IPurchaseOrderDetailitemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class PurchaseOrderDetailServiceImpl extends ServiceImpl<PurchaseOrderDetailMapper, PurchaseOrderDetail> implements IPurchaseOrderDetailService {
    private static final Logger log = LoggerFactory.getLogger(PurchaseOrderDetailServiceImpl.class);

    @Override
    public void saveOrderDetail(PurchaseOrderDetail purchaseOrderDetail) {
        QueryWrapper<PurchaseOrderDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("purchase_sheet_id", purchaseOrderDetail.getPurchaseSheetId());
        baseMapper.delete(queryWrapper);
        this.save(purchaseOrderDetail);
    }
}